package org.blogwu.learn.jvmlearn.class2;

public class Demo1 {

    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
        ClassLoader2 cl1 = new ClassLoader2("class1");
        ClassLoader2 cl2 = new ClassLoader2("class2");

        Class cz1 = cl1.loadClass("org.blogwu.learn.jvmlearn.class2.MyTest1");
        System.out.println(cz1.getClassLoader());
        System.out.println(cz1.getClassLoader().getParent().getClass());

        Class cz2 = cl2.loadClass("org.blogwu.learn.jvmlearn.class2.MyTest1");
        System.out.println(cz2.getClassLoader());
        System.out.println(cz2.getClassLoader().getParent().getClass());
        System.out.println("----------");
        System.out.println(cz2.isInstance(cz2));
        Object o1 = cz1.newInstance();
        System.out.println(o1.getClass());

        Object o2 = cz2.newInstance();
        System.out.println(o2.getClass());
    }
}
